let myHeading = document.querySelector("h1");
let button = document.querySelector("button");

myHeading.textContent = "Hello World";

let img = document.querySelector("img");
img.onclick = () => {
    var src = img.getAttribute("src");
    if(src === "images\\OIP-C.jpg"){
        img.setAttribute("src","images\\OIP-C2.jpg");
    }else{
        img.setAttribute("src","images\\OIP-C.jpg");
    }
}

button.onclick = () => {
    setUserName();
}

function setUserName(){
    let name = prompt("enter your name:")
    localStorage.setItem("name",name);
    myHeading.textContent = "Willcome " + name;
}

if(!localStorage.getItem("name")){
    setUserName();
}else{
    var name = localStorage.getItem("name");
    myHeading.textContent = "Willcome " + this.name;
}